<template>
   <div>
        <h1>计数器</h1>
        <h2>{{$store.state.num}}</h2>
        <button @click="increment">+1</button>
        <button @click="incrementN(3)">+3</button>
   </div>
</template>

<script>
export default {
   methods:{
    increment(){
        this.$store.commit('INCREMENT')
    },
    incrementN(n){
        this.$store.commit('INCREMENT_N',n)
    }
   }
}
</script>

<style>

</style>